<template>
  <div class="login">
    <div class="login-content">
        <el-card shadow="hover" :body-style="{ padding: '0px' }" class="login-left">
          <h3 class="title">来源杂货后台管理系统</h3>
        </el-card>
        <el-card shadow="hover" :body-style="{ padding: '0px' }" class="login-right">
          <el-tabs v-model="activeName" class="demo-tabs" @tab-change="handleClick">
            <el-tab-pane label="账号登录" name="userLogin">
              <!-- 账号登录 -->
              <user-login v-if="activeName == 'userLogin' "></user-login>
            </el-tab-pane>
            <el-tab-pane label="手机号登录" name="phoneLogin">
               <!-- 手机号登录 -->
               <phone-login v-if="activeName == 'phoneLogin' "></phone-login>
            </el-tab-pane>
          </el-tabs>
        </el-card>
        
    <!-- <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
      <h3 class="title">来源杂货后台管理系统</h3>
      <el-form-item prop="username">
        <el-input
          v-model="loginForm.username"
          type="text"
          size="large"
          auto-complete="off"
          placeholder="账号"
        >
          <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
        </el-input>
      </el-form-item>
      <el-form-item prop="password">
        <el-input
          v-model="loginForm.password"
          type="password"
          size="large"
          auto-complete="off"
          placeholder="密码"
          @keyup.enter="handleLogin"
        >
          <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
        </el-input>
      </el-form-item>
      <el-form-item prop="code" v-if="captchaEnabled">
        <el-input
          v-model="loginForm.code"
          size="large"
          auto-complete="off"
          placeholder="验证码"
          style="width: 63%"
          @keyup.enter="handleLogin"
        >
          <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
        </el-input>
        <div class="login-code">
          <img :src="codeUrl" @click="getCode" class="login-code-img"/>
        </div>
      </el-form-item>
      <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
      <el-form-item style="width:100%;">
        <el-button
          :loading="loading"
          size="large"
          type="primary"
          style="width:100%;"
          @click.prevent="handleLogin"
        >
          <span v-if="!loading">登 录</span>
          <span v-else>登 录 中...</span>
        </el-button>
        <div style="float: right;" v-if="register">
          <router-link class="link-type" :to="'/register'">立即注册</router-link>
        </div>
      </el-form-item>
    </el-form> -->
    <!--  底部  -->
    <!-- <div class="el-login-footer">
       <span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span> -->
    </div>
  </div>
</template>

<script setup>
import UserLogin from "./loginForm/userLogin.vue"
import phoneLogin from "./loginForm/phoneLogin.vue";

const activeName = ref('userLogin')
function handleClick (TabPaneName) {
  activeName.value = TabPaneName
}

</script>

<style lang='scss' scoped>
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/images/chengbao.jpg");
  background-size: cover;
}
.login-content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 1000px;
  height: 540px;
  background: #bfbfbf;
  .login-left {
    width: 600px;
    height: 540px;
    background-image: url("../assets/images/login_left.jpg");
    background-size: cover;
    background-repeat: no-repeat;
  }
  .login-right {
    width: 400px;
    height: 540px;
  }
}
.image {
  width: 100%;
  display: block;
}
.title {
  margin: 60px auto 30px auto;
  text-align: center;
  color: #fff;
  font-size: 30px;
  font-weight: 600;
}
.demo-tabs ::v-deep .el-tabs__nav-scroll {
  display: flex;
  justify-content: center;
  align-items: center;
}
.demo-tabs ::v-deep .el-tabs__nav-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
   background-color: #fff; 
  z-index: var(--el-index-normal);
}
</style>
